All the Matlab files have been executed in Matlab 2016a. Note that other Matlab version may produce numerical results that might slightly be different.  


General notes. 

a. Before empirical investigations, we remove the top 1% observations  of price (that is, price values above 20000). 

b. The demand estimation is obtained using Newey (1987). The estimation procedure first appears in the file Main2.m. Since unconstrained estimation satisfies shape constraints -- 
as verified in the Main2.m code using numerical directional derivatives and the sign on the coefficient for the price variable, we do not impose shape constraints in the estimation. 
(It is indicated in the code though where shape constraints would have to be included in the estimation if unconstrained estimation violated them, hence, ultimately making shape constraints binding). Note that numerically the shape 
constraints are verified only in file Main2.m. This is not done in subsequent files Main3.m-Main6.m since the estimation procedure is identical to that in file Main2.m. 

c. TryBSpline package is used to generate base B=splines for a given order/degree and a given system of knots. 

d. Input data file is 'Tuition_IV.xlsx'. We use the folloiwng variables: 
Age is in column 5
Household size is in column 12
Income is in column 13
Male dummy is in column 16
Binary choice indicator is in column 17
Price is in column 18
Hausman-type instruments are in column 19




Details

1. To replicate the upper panel of Table 1 run the file Main1.m. 

2. To replicate the second column of the lower panel of Table 2 as well the left display in Figure 2 run file Main2.m. 

3. To replicate the third column of the lower panel of Table 2 run file Main3.m. 

4. To replicate the central and the right displays in Figure 2 as well as Figure 4 run file Main4.m. 

4. To replicate the left-hand side display in Figure 3 run file Main5.m. As inputs, Main5.m uses optimal subsidy allocations (with zeros average cost) obtained for three different welfare criteria. 
In Excel files ('allocation_casw0.xls', 'allocation_ate.xls', 'allocation_acv.xls') these allocations correspond to an ordered sequence of iunqiue incomes observed in the data with the top three incomes excluded (treated as having the flabvout of outliers) to ensure 
the stability of the optimization procedure. By doing this, we only exclude 8 observations in total. This is also evident from the code in Main 6 (it is also evident there how to obtain these unique values of incomes as well as    
the number of occurences of each unique income value in the sample). 

5. To replicate the right-hand side display in Figure 3 run file Main6.m.  As input files, use 'allocation_casw0.xls', 'allocation_ate.xls'. 

